import React from 'react';
import {Card, Button, notification} from 'antd';
import './ui.less';


export default class Notification extends React.Component {
    openNotice = (type,placement) => {
        if (placement) {
            //提供了一个全局配置方法，在调用前提前配置，全局一次生效。
            notification.config({
                placement:placement
            })
        }
        notification[type]({
            message: '工资到账了',
            description: '实际到账工资2800 ！ 请注意查收！'
        })


    };

    render() {
        return (
            <div>
                <Card title="消息提醒框" className="card-wrap">

                    <Button type="primary" onClick={() => this.openNotice('success','topLeft')}>success</Button>
                    <Button type="primary" onClick={() => this.openNotice('info','topRight')}>info</Button>
                    <Button type="primary" onClick={() => this.openNotice('warning','bottomLeft')}>warning</Button>
                    <Button type="primary" onClick={() => this.openNotice('error','bottomRight')}>error</Button>
                </Card>
            </div>
        )
    }

}
